﻿@model Mello.ImageGallery.ViewModels.ImageGalleryImagesViewModel
@using Orchard.Media.Extensions
@{ Style.Require("ImageGalleryAdmin"); }
@{ Script.Require("jQueryUISortable"); }
@{ Script.Include("Admin/Images.js"); }


@{ Layout.Title = T("Manage Image Gallery").ToString(); }

<div class="clearBoth"></div>

@using (Html.BeginFormAntiForgeryPost())
{
    <div class="manage">
        @Html.ActionLink(T("Add images").ToString(), "AddImages", new { imageGalleryName = Model.ImageGalleryName }, new { @class = "button primaryAction" })
        @Html.ActionLink(T("Image Gallery Properties").ToString(), "EditProperties", new { imageGalleryName = Model.ImageGalleryName }, new { @class = "button" })
    </div>
    
    <h2>@Model.ImageGalleryName</h2>
    
        <input type="hidden" id="imageGalleryName" name="imageGalleryName" value="@Model.ImageGalleryName" />
    
    <fieldset>
        <table id="images" class="items" summary="@T("This is a table of the images of your image gallery.")">
            <thead>
                <tr>
                    <th>
                        &nbsp;↓
                    </th>
                    <th>
                        @T("Name")
                    </th>
                    <th>
                        @T("Author")                        
                    </th>
                    <th>
                        @T("Last Updated")                          
                    </th>
                    <th>
                        @T("Size")  
                    </th>
                    <th>
                        @T("Title")  
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var image in Model.Images)
                {
                <tr>
                    <td class="sort">                        
                        <img src='@Href("~/Modules/Mello.ImageGallery/Content/Images/grip.png")'  alt="grip" />
                    </td>
                    <td class="name">                        
                        @Html.ActionLink(@image.Name, "EditImage", new { imageGalleryName = @Model.ImageGalleryName, imageName = @image.Name }) 
                    </td>
                    <td>
                        @image.User
                    </td>
                    <td>
                        @image.LastUpdated
                    </td>
                    <td>
                        @image.Size.ToFriendlySizeString()
                    </td>
                    <td>
                        @image.Title
                    </td>
                </tr>
                }
            </tbody>
        </table>
    </fieldset>
    
    @Html.ActionLink("Back", "Index", null, new { Class = "button" })
}